package com.design.mode.observer;

/**
 * 描述:
 * 观察者模式测试
 *
 * @author luzhongfu
 * @create 2018-12-23 3:15 PM
 */
public class MainObserver {

    public static void main(String[] args) {
        Observer xiaoming = new User("xiaoming");
        Observer xiaohong = new User("xiaohong");
        Observer xiaolan = new User("xiaolan");
        Observer xiaozhang = new User("xiaozhang");

        WebchartServer web = new WebchartServer();
        web.registerObserver(xiaohong);
        web.registerObserver(xiaoming);
        web.registerObserver(xiaolan);
        web.registerObserver(xiaozhang);
        web.setInformation("哈哈 我是大佬");
        web.removeObserver(xiaozhang);
        web.setInformation("java是世界上最好的语言");
    }
}
